<template>
  <div>
    <div class="wrap-banner" @click="handleBannerClick">
      <img :src="bannerImg"
           class="banner-img">
      <div class="banner-info">
        <div class="banner-title">{{sightName}}</div>
        <div class="banner-number">
          <span class="iconfont icon-banner">&#xe608;</span>{{this.bannerImg.length}}
        </div>
      </div>
    </div>
    <fade-animation>
      <common-gallary :imgs="gallaryImgs" v-show="showGallary" @close="handleGallaryClose"></common-gallary>
    </fade-animation>
  </div>
</template>

<script>
import commonGallary from 'common/gallary/gallary'
import fadeAnimation from 'common/fade/fade'

export default {
  name: 'banner',
  props: {
    sightName: String,
    bannerImg: String,
    gallaryImgs: Array
  },
  data () {
    return {
      showGallary: false
    }
  },
  components: {
    commonGallary,
    fadeAnimation
  },
  methods: {
    handleBannerClick () {
      this.showGallary = true
    },
    handleGallaryClose () {
      this.showGallary = false
    }
  }
}
</script>

<style lang="stylus" scoped>
  .wrap-banner
    position: relative
    overflow hidden
    height: 0
    padding-bottom: 30.48%

  .banner-img
    display: block
    width: 100%

  .banner-info
    position: absolute
    display: flex
    left: 0
    right: 0
    bottom: 0
    line-height: 0.6rem
    color: #fff
    background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8))

  .banner-title
    flex 1
    padding: 0 0.2rem
    font-size 0.32rem

  .banner-number
    margin-top: 0.14rem
    padding: 0 0.4rem
    height: 0.32rem
    line-height: 0.32rem
    border-radius: 0.2rem
    font-size 0.24rem
    background rgba(0, 0, 0, 0.8)

  .icon-banner
    font-size 0.24rem

</style>
